//
//  SearchNumCell.swift
//  ImGuider X
//
//  Created by 王鹏宇 on 10/17/18.
//  Copyright © 2018 imguider. All rights reserved.
//

import UIKit

class SearchNumCell: UITableViewCell {
    
    
    @IBOutlet weak var numLabel: UILabel!
    @IBOutlet weak var nameLabel: UILabel!
    
    @IBOutlet weak var officalNameLabel: UILabel!
    @IBOutlet weak var officalNameHeight: NSLayoutConstraint!
    
    @IBOutlet weak var officalNumLabel: UILabel!
    @IBOutlet weak var numHeight: NSLayoutConstraint!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        
        setup()
    }

    
    func setup(){
        
        nameLabel.textColor = kSubitleColor
        nameLabel.font = UIFont.systemFont(ofSize: 14)
        officalNumLabel.font = UIFont.systemFont(ofSize: 12)
        officalNumLabel.textColor = kContentColor
        
        officalNameLabel.font = UIFont.systemFont(ofSize: 12)
        officalNameLabel.textColor = kContentColor
        
        numLabel.layer.cornerRadius = 10.5
        numLabel.clipsToBounds = true
        numLabel.layer.borderWidth = 1.0
        numLabel.layer.borderColor = UIColor.white.cgColor
        numLabel.isHidden = true
    }
    
    func configData(record : Record){
        
        self.nameLabel.text = record.spotname
        
        if let enstr = record.ename,enstr.count > 0 {
            
            self.officalNameLabel.text = LocalizedString("record_name") + "：" + enstr
            
        }else {
            self.officalNameLabel.text = ""
        }
        
        if let node = record.nodenumber,node.count > 0 {
            
            self.officalNumLabel.text = LocalizedString("record_id") + "：" + node
        }else {
            
            self.officalNameLabel.text = ""
        }
        
        if let num = record.number,num > 0 {
            self.numLabel.text = "\(num)"
            self.numLabel.isHidden = false
        }else {
            self.numLabel.isHidden = true
        }
        
        
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
